package com.lanhao.aot.fastjson;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

public class JSONParseUtil {
	public static void main(String[] args) {
		String s1 = "{\"code\":\"0000\",\"message\":\"成功\",\"value\":\"TestValue\"}";

		Result<String> r1 = JSON.parseObject(s1, new TypeReference<Result<String>>(String.class) {
		});
		System.out.println(r1.getValue());
		
		
		String s2 = "{\"code\":\"9999\",\"message\":\"失败\",\"value\":{\"name\":\"小红\",\"hobby\":\"画画\"}}";
		Result<MockVo> r2 = JSON.parseObject(s2, new TypeReference<Result<MockVo>>(MockVo.class) {
		});
		System.out.println(r2.getValue().getHobby());
	}
}
